package entity

import "encoding/json"

type FeePlanPaymentOrder struct {
	Id             int64           `gorm:"column:id;primary_key" json:"id"`
	TradeNo        string          `gorm:"column:trade_no;type:varchar(128);uniqueIndex;comment:交易订单唯一标识" json:"trade_no"`
	PrepayId       string          `gorm:"column:prepay_id;type:varchar(4096);comment:第三方预支付ID" json:"prepay_id"`
	UserId         int64           `gorm:"column:user_id;type:bigint;index;comment:用户ID" json:"user_id"`
	UserName       string          `gorm:"column:user_name;type:varchar(255);index;comment:用户名称" json:"user_name"`
	UserPhone      string          `gorm:"column:user_phone;type:varchar(32);index;comment:用户手机号" json:"user_phone"`
	EbikeId        int64           `gorm:"column:ebike_id;type:bigint;index;comment:车辆ID" json:"ebike_id"`
	EbikeName      string          `gorm:"column:ebike_name;type:varchar(128);comment:车辆名称" json:"ebike_name"`
	EbikeSnCode    string          `gorm:"column:ebike_sn_code;type:varchar(64);comment:车辆SN" json:"ebike_sn_code"`
	EbikeTypeId    int64           `gorm:"column:ebike_type_id;type:bigint;comment:车辆ID" json:"ebike_type_id"`
	EbikeTypeName  string          `gorm:"column:ebike_type_name;type:varchar(64);comment:车辆类型名称" json:"ebike_type_name"`
	Status         int             `gorm:"column:status;type:smallint default 0 not null;comment:订单状态(0:已创建,待支付,1:支付成功,2:支付超时,被取消,3:用户取消支付,4:已退款,5:支付失败)" json:"status"`
	StatusDetail   json.RawMessage `gorm:"column:status_detail;type:json;comment:状态详情,记录第三方支付" json:"status_detail"`
	Description    string          `gorm:"column:description;type:varchar(512)" json:"description"`
	FeePlanId      int64           `gorm:"column:fee_plan_id;type:bigint;comment:套餐ID" json:"fee_plan_id"`
	FeePlanGroupId int64           `gorm:"column:fee_plan_group_id;type:bigint;comment:套餐组ID" json:"fee_plan_group_id"`
	FeePlanPackNo  int             `gorm:"column:fee_plan_pack_no;type:integer;comment:套餐产品ID对应pack字段的No" json:"fee_plan_pack_no"`
	Money          int             `gorm:"column:money;type:integer default 0 not null" json:"money"`
	CallBackCnt    int             `gorm:"column:call_back_cnt;type:integer" json:"call_back_cnt"`
	Channel        string          `gorm:"column:channel;type:varchar(32)" json:"channel"`
	CallBackData   string          `gorm:"column:call_back_data;type:text;" json:"call_back_data"`
	TransactionId  string          `gorm:"column:transaction_id;type:varchar(255);index;comment:第三方订单唯一标识" json:"transaction_id"`
	PayAt          int64           `gorm:"column:pay_at;type:bigint;index;comment:支付成功时间" json:"pay_at"`
	ExpiredAt      int64           `gorm:"column:expired_at;type:bigint;comment:过期时间" json:"expired_at"`
	CreatedAt      int64           `gorm:"column:created_at;type:bigint;index;comment:创建时间" json:"created_at"`
	UpdatedAt      int64           `gorm:"column:updated_at;type:bigint;index;comment:更新时间" json:"updated_at"`
}

func (f *FeePlanPaymentOrder) TableName() string {
	return "fee_plan_payment_order"
}
